import type { SchoolHouse } from '@/types/donation'
import type { Data, TableDataInfo } from '@/types/global'
import type { Donation, GoodsShelves } from '@/types/home'
import { http } from '@/utils/http'

/**
 * 获取学校列表
 * @returns
 */
export const getSchoolListVoAPI = () => {
  return http<TableDataInfo<SchoolHouse>>({
    url: `/school/listVo`,
    method: 'GET',
  })
}

/**
 * 申请捐赠
 * @returns
 */
export const postDonationAPI = (data: Donation) => {
  return http<TableDataInfo<Donation>>({
    url: `/donation`,
    method: 'POST',
    data,
  })
}

export const putStorageOrPickUpAPI = (data?: GoodsShelves, type?: string) => {
  return http<Data<number>>({
    url: `/donation/storageOrPickup/${type}`,
    method: 'PUT',
    data,
  })
}
